import { View } from "@tarojs/components";
import HeaderSearch from "@/components/HeaderSearch/index";
import Header from "@/components/Header/index";
import Footer from "@/components/Footer/index";
import GoodsTitle from "@/components/GoodsTitle/index";
import { useEffect, useState } from "react";
import { requestPOST } from "@/request";

export default function Index() {
  const [help, setHelp] = useState("");

  const getHelp = () => {
    requestPOST("other/merchantHelp").then((res: any) => {
      setHelp(res.merchant_help.replaceAll("https://etouch1api.etouch-b2b.com", process.env.TARO_APP_API));
    });
  };

  useEffect(() => {
    getHelp();
  }, []);
  return (
    <View>
      <HeaderSearch />
      <Header />
      <View>
        <GoodsTitle title="帮助中心" isMore={false} />
        <View style={{ padding: "14px" }}>
          {help && (
            <View
              style={{ marginTop: "14px" }}
              dangerouslySetInnerHTML={{ __html: help }}
            ></View>
          )}
        </View>
      </View>
      <Footer />
    </View>
  );
}
